home *** CD-ROM | disk | FTP | other *** search
- on CheckCopyProcess
- global gFileObj, gCopyID, gFileToCopy, gFileList, gPrevBytes, gBytes, gSrcPathList, gDestPathList
- set done to GetStatus()
- if done = 100 then
- set gFileToCopy to gFileToCopy + 1
- if gFileToCopy > count(gFileList) then
- gFileObj(mCopyFileTaskDispose, gCopyID)
- return 0
- exit
- else
- set gPrevBytes to gPrevBytes + gFileObj(mCopyFileTaskBytesCopied, gCopyID)
- gFileObj(mCopyFileTaskDispose, gCopyID)
- set sourcepath to getAt(gSrcPathList, gFileToCopy)
- set destPath to getAt(gDestPathList, gFileToCopy)
- set srcFile to sourcepath & getAt(gFileList, gFileToCopy)
- set DestFile to destPath & GetDestFileName(getAt(gFileList, gFileToCopy))
- StartCopy(srcFile, DestFile)
- end if
- end if
- set gBytes to gPrevBytes + gFileObj(mCopyFileTaskBytesCopied, gCopyID)
- return 1
- end
-
- on GetStatus
- global gFileObj, gCopyID
- set percentDone to gFileObj(mCopyFileTaskDoMore, gCopyID)
- if percentDone = 101 then
- CopyErr()
- exit
- end if
- return percentDone
- end
-
- on GetCopyInfo
- global gFileObj, gCopyID, gFileToCopy, gFileList, gBytes, gSpaceNeeded, gProcKlart
- set FilePercent to gFileObj(mCopyFileTaskPercentDone, gCopyID)
- if FilePercent = 101 then
- CopyErr()
- exit
- end if
- if gFileToCopy > count(gFileList) then
- set fileName to getAt(gFileList, count(gFileList))
- else
- set fileName to getAt(gFileList, gFileToCopy)
- end if
- set gProcKlart to integer(float(gBytes) / float(gSpaceNeeded) * 100)
- set K to [gProcKlart, FilePercent, fileName]
- return K
- end
-
- on CopyErr
- global gFileObj, gCopyID
- if integerp(gCopyID) then
- set err to gFileObj(mCopyFileTaskError, gCopyID)
- ErrorDeCoder(err)
- end if
- go("FAIL")
- end
-
- on CopyAbort
- global gFileObj, gCopyID
- if integerp(gCopyID) then
- set K to gFileObj(mCopyFileTaskCancel, gCopyID)
- CopyErr()
- cleanUpFiles()
- end if
- go("FAIL")
- end
-
- on cleanUpFiles
- global gMiscObj, gFileObj, gFileList, gDestPathList, gDestPath
- case the platform of
- "Macintosh,68k", "Macintosh,PowerPC":
- set fldr to "BackPacker 2:"
- "Windows,16", "Windows,32":
- set fldr to "BP2\"
- end case
- set path to gDestPath & fldr
- gMiscObj(mDeleteFolder, path)
- end
-